var ReservationsSecondLog = {
    id: "ReservationsSecondLogTable",
    seItem: null,
    table: null,
    layerIndex: -1
};

ReservationsSecondLog.initColumn = function () {
    return [
        {title: '', field: 'id', visible: false, align: 'center', valign: 'middle', width: '50px'},
        {title: '操作人', field: 'singlePerson', align: 'center', valign: 'middle', sortable: true},
        {title: '患者电话', field: 'customerPhone', align: 'center', valign: 'middle', sortable: true},
        {title: '患者姓名', field: 'customerName', align: 'center', valign: 'middle', sortable: true},
        {title: '操作时间', field: 'createTime', align: 'center', valign: 'middle', sortable: true},
        {title: '建档人', field: 'archiving', align: 'center', valign: 'middle', sortable: true},
        {title: '归属人', field: 'belonger', align: 'center', valign: 'middle', sortable: true},
        {title: '跟进人', field: 'follower', align: 'center', valign: 'middle', sortable: true},
        {title: '新建档人', field: 'newArchiving', align: 'center', valign: 'middle', sortable: true},
        {title: '新归属人', field: 'newBelonger', align: 'center', valign: 'middle', sortable: true},
        {title: '新跟进人', field: 'newFollower', align: 'center', valign: 'middle', sortable: true},
        {title: '原一级渠道', field: 'oneChannel', align: 'center', valign: 'middle', sortable: true},
        {title: '新一级渠道', field: 'newOneChannel', align: 'center', valign: 'middle', sortable: true},
        {title: '内容', field: 'classname', align: 'center', valign: 'middle', sortable: true},
    ];
};

ReservationsSecondLog.formParams = function () {
    var queryData = {};
    queryData['singlePerson'] = $("#singlePerson").val();
    queryData['customerPhone'] = $("#customerPhone").val();
    queryData['customerName'] = $("#customerName").val();
    queryData['startTime'] = $("#startTime").val();
    queryData['endTime'] = $("#endTime").val();
    return queryData;
};

ReservationsSecondLog.resetSearch = function () {
    $("#singlePerson").val("");
    $("#customerPhone").val("");
    $("#customerName").val("");
    $("#startTime").val("");
    $("#endTime").val("");
    ReservationsSecondLog.search();
};

ReservationsSecondLog.search = function () {
    ReservationsSecondLog.table.refresh({query: ReservationsSecondLog.formParams()});
};
ReservationsSecondLog.today = function () {//点击上面状态筛选表格
    $("#startTime").val(setDateTime(new Date(),0) + " " + "00:00:00");
    $("#endTime").val(setDateTime(new Date(),0) + " " + "23:59:59");
    ReservationsSecondLog.search();
};

$(function () {
    var defaultColunms = ReservationsSecondLog.initColumn();
    var table = new BSTable(ReservationsSecondLog.id, "/reservations_second_log/list", defaultColunms);
    table.setPaginationType("server");
    table.setQueryParams(ReservationsSecondLog.formParams());
    ReservationsSecondLog.table = table.init();
    ReservationsSecondLog.today();
    $(document).on('click','#laydate_clear,#laydate_today,#laydate_ok',function () {ReservationsSecondLog.search();});
    checkDate = function () {ReservationsSecondLog.search();};
});